Skip to content

feat(source-bing-ads): migrate accounts stream to manifest#59136

Merged
Aldo Gonzalez (aldogonzalez8) merged 33 commits intomasterfrom
ac8/migrate-accounts-to-low-code
May 6, 2025
Merged

feat(source-bing-ads): migrate accounts stream to manifest#59136
Aldo Gonzalez (aldogonzalez8) merged 33 commits intomasterfrom
ac8/migrate-accounts-to-low-code

Conversation

@aldogonzalez8
Copy link
Contributor

@aldogonzalez8 Aldo Gonzalez (aldogonzalez8) commented Apr 28, 2025

What

Fix the unit and integration tests to pass as the base source was changed to YamlDeclarativeSource

Depends on: airbytehq/airbyte-python-cdk#519
Resolves: https://github.com/airbytehq/airbyte-internal-issues/issues/12668

How

User helper for source creation.

Review guide

User Impact

A step further to migrate to low code.

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

@vercel
Copy link

vercel bot commented Apr 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 2:46pm

output, _ = self.read_stream(self.stream_name, SyncMode.full_refresh, self._config, "app_install_ad_labels_empty")
assert len(output.records) == 0
assert len(output.logs) == 11
assert len(output.logs) == 12
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ConcurrentDeclarativeSource in read() calls self. _ group_streams (), which calls self.streams()

At the end of that, it calls super.read(), which is AbstractSource.read(), which collects streams again.

The override of the streams method in source-bing-ads creates an authentication client, so we initialize it twice, and we receive an extra log entry for "Fetching access token ...".

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just remove this? It does not seem to indicate any behavior for this connector and is going to be flaky if we add logs in the CDK

Can we check in the history is there is a reason it was added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it but added support to check the behavior, meaning I assert the expected logs for the test behavior.

)


def build_request_2(config: Dict[str, Any]) -> HttpRequest:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is temporary until we migrate all to REST, right? Can we add a document why this is different? I guess this is just the order or stuff

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have documented this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Can we remove the user stream here?

  • Do we have difference between REST and SOAP for account stream?

) as service_call_mock:
catalog = CatalogBuilder().with_stream(stream_name, sync_mode).build()
return read(SourceBingAds(), config, catalog, state, expecting_exception), service_call_mock
# return read(SourceBingAds(), config, catalog, state, expecting_exception), service_call_mock

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: to remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-paste is the source of all evil, removed.


class RequestBuilder:
def __init__(self, resource: str = None) -> None:
self._spreadsheet_id = None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: clean this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-paste is the source of all evil, removed.

output, _ = self.read_stream(self.stream_name, SyncMode.full_refresh, self._config, "app_install_ad_labels_empty")
assert len(output.records) == 0
assert len(output.logs) == 11
assert len(output.logs) == 12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just remove this? It does not seem to indicate any behavior for this connector and is going to be flaky if we add logs in the CDK

Can we check in the history is there is a reason it was added?

@aldogonzalez8 Aldo Gonzalez (aldogonzalez8) changed the base branch from maxi297/migrate-accounts-to-low-code to master April 29, 2025 17:42
@aldogonzalez8 Aldo Gonzalez (aldogonzalez8) marked this pull request as ready for review April 29, 2025 17:42
@aldogonzalez8
Copy link
Contributor Author

Ok, interpretation of these regressions_tests results:

  • test_catalog_are_the_same[CONNECTION 9ee7920] [failed]
    • is_file_based appeared, this is expected in cdk ^6.45.10
    • Many "number" attributes were changed "integer" so this was expected as well.
  • TestDataIntegrity.test_record_schema_match_with_state[CONNECTION 9ee7920] [failed]
    • TaxInformation is returned in rest version of the API if empty ("[]"), this was not happening for soap but I don't think this is a problem, just as follow up will try to find a connection with "TaxInformation" not empty.
  • TestDataIntegrity.test_all_records_are_the_same_with_state[CONNECTION 9ee7920] [failed]
    • Same thing, TaxInformation is there even if there is no data to show "[]"

Follo up: find a connection with TaxInformation

@aldogonzalez8
Copy link
Contributor Author

Follow up: find a connection with TaxInformation

Sadly, I couldn't find any connection with TaxInformation filled to compare, so I think I'm okay with letting it be as it is, making the RC, and seeing if we get any feedback from this change.

What I did was create a test for the LinkedAgencies transformation we just added.

I ran another Progressive Rollout for a connection with four accounts and got similar results to exposed above.

  • LinkedAgencies: We get it even if empty array, as we have a transformation to iterate to make it compatible with SOAP version.
  • TaxInformation: for REST it is returned as an empty array when no data, this is not happening for SOAP but as this is additive I think this is not a problem.

I expect to create the RC tomorrow and follow up.

cc Brian Lai (@brianjlai)

@aldogonzalez8 Aldo Gonzalez (aldogonzalez8) merged commit 32c5638 into master May 6, 2025
27 checks passed
@aldogonzalez8 Aldo Gonzalez (aldogonzalez8) deleted the ac8/migrate-accounts-to-low-code branch May 6, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants